package com.lit.mqtt.client2;

import com.lit.mqtt.client2.boot.config.ApplicationConfig;
import com.lit.common.util.ApplicationUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration;
import org.springframework.context.annotation.Import;

@SpringBootConfiguration
@EnableAutoConfiguration(exclude = {JpaRepositoriesAutoConfiguration.class})
@Import({ApplicationConfig.class})
public class MqttClient2Application {

    public static void main(String[] args) {
        long beginTime = System.currentTimeMillis();

        SpringApplication.run(MqttClient2Application.class, args);

        long endTime = System.currentTimeMillis();

        String mqttInfoStr = "\t服务器: "+ApplicationUtils.getProperty("spring.mqtt.url") + "\n" +
                             "\t用户名: "+ApplicationUtils.getProperty("spring.mqtt.username")+ "，密码:"+ApplicationUtils.getProperty("spring.mqtt.password") +"\n" +
                             "\t客户端ID:"+ApplicationUtils.getProperty("spring.mqtt.client.id");

        System.out.println("------------------------------------------ -----------------------------\n" +
                "-----------------------------------------------------------------------\n" +
                "                               _     _\n" +
                "                              ( \\---/ )\n" +
                "                               ) . . (\n" +
                "-------------------------,--._(___Y___)_,--.---------------------------\n" +
                "                         `--'           `--'\n" +
                "                         \t"+ ApplicationUtils.getProperty("application.name")+"启动成功                         \n" +
                " 启动耗时: " + (endTime - beginTime) + "毫秒 \n" +
                " 端口: "+ ApplicationUtils.getProperty("server.port") +" \n" +
                " 配置文件环境: " + ApplicationUtils.getProperty("spring.profiles.active") +"\n" +
                " Actuator监控系统访问地址: http://127.0.0.1:"+ApplicationUtils.getProperty("server.port")+"/actuator \n" +
                " Swagger接口文档访问地址: http://127.0.0.1:"+ApplicationUtils.getProperty("server.port")+"/swagger-ui.html \n" +
                " MQTT服务器相关配置: \n" +
                mqttInfoStr + "\n" +
                "-----------------------------------------------------------------------\n" +
                "  \n");
    }

}
